﻿using System;
using System.Net;
using System.Windows;
using System.Windows.Controls;
using System.Windows.Documents;
using System.Windows.Ink;
using System.Windows.Input;
using System.Windows.Media;
using System.Windows.Media.Animation;
using System.Windows.Shapes;

namespace Galaktika.BI.Silverlight.Controls.PivotGrid
{
    internal class WaitCursor : IDisposable
    {
        private readonly Cursor m_OldCursor;
        private readonly FrameworkElement m_Element;
        public WaitCursor(FrameworkElement element)
        {
            if (element == null)
                throw new ArgumentNullException("element");
            m_OldCursor = element.Cursor;
            m_Element = element;
            m_Element.Cursor = Cursors.Wait;
        }

        #region IDisposable Members

        public void Dispose()
        {
            if(m_Element != null)
               m_Element.Cursor = m_OldCursor;
        }

        #endregion
    }
}
